<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Title</title>
  <script>
    function myFunction(){
  var demo= document.getElementById("demo").innerHTML
      demo++
      document.getElementById("demo").innerHTML=demo
    }
  </script>
</head>
<body>
<p>局部变量计数。</p>
<button type="button" onclick="myFunction()">计数!</button>
<p id="demo">0</p>

</body>
</html>
